package com.quark.common.dao;

import com.quark.common.entity.Label;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LabelDao extends JpaRepository<Label,Integer> {

    @Query(value = "from Label l where l.name=?1")
    public Label findByName(String name);

    @Query(value = "from Label l where l.parentId=?1")
    List<Label> findByParentLableId(Integer labelId);
}
